package com.idol.dubbo.impl;

import com.idol.dubbo.api.SayHiService;
import org.apache.dubbo.config.annotation.Service;

import java.util.Random;

/**
 * @author SupremeSir
 * @description
 * @className SayHiServiceImpl
 * @date 2021/1/21 22:55
 **/
@Service
public class SayHiServiceImpl implements SayHiService {
    private final Random random = new Random();
    @Override
    public String sayHi(String name) {
        try {
            Thread.sleep(random.nextInt(100));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "你好啊，" + name + "！";
    }

    @Override
    public String sayBye(String name) {
        try {
            Thread.sleep(random.nextInt(100));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "再见啊，" + name + "！";
    }

    @Override
    public String sayGoodNight(String name) {
        try {
            Thread.sleep(random.nextInt(100));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "晚安啊，" + name + "！";
    }
}
